
FROM golang:alpine AS builder

WORKDIR /go/kingProject

COPY . /go/kingProject

ENV GOPROXY https://goproxy.cn,direct

RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" main.go



FROM alpine AS runner

WORKDIR /go/kingProject

COPY --from=builder /go/kingProject/main .
COPY --from=builder /go/kingProject/config ./config
COPY --from=builder /go/kingProject/conf ./conf

RUN echo "https://mirrors.aliyun.com/alpine/v3.8/main/" > /etc/apk/repositories \
    && echo "https://mirrors.aliyun.com/alpine/v3.8/community/" >> /etc/apk/repositories \
    && apk add --no-cache tzdata \
    && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime  \
    && echo Asia/Shanghai > /etc/timezone \
    && apk del tzdata

EXPOSE 8790

VOLUME ["/go/kingProject/config","/go/kingProject/logger"]

ENTRYPOINT ["./main"]
